package com.education.wisdom.service.impl;

import com.education.common.utils.Convert;
import com.education.wisdom.mapper.ChaptersMapper;
import com.education.wisdom.pojo.Chapters;
import com.education.wisdom.service.IChaptersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 大纲 服务层实现
 * 
 * @author ruoyi
 * @date 2018-10-25
 */
@Service
public class ChaptersServiceImpl implements IChaptersService
{
	@Autowired
	private ChaptersMapper chaptersMapper;

	/**
     * 查询大纲信息
     * 
     * @param chNumber 大纲ID
     * @return 大纲信息
     */
    @Override
	public Chapters selectChaptersById(String chNumber)
	{
	    return chaptersMapper.selectChaptersById(chNumber);
	}
	
	/**
     * 查询章节列表
     * 
     * @param chCurriculumid 课程编号
     * @return 大纲集合
     */
	@Override
	public List<Chapters> selectChaptersListByCurrId(String chCurriculumid)
	{
	    return chaptersMapper.selectChaptersListByCurrId(chCurriculumid);
	}

	/**
	 * 查询章节信息
	 * @param chCurriculumid 课程编号
	 * @return
	 */
	@Override
	public List<Chapters> selectChaptersByCurrId(String chCurriculumid) {
		return chaptersMapper.selectChaptersByCurrId(chCurriculumid);
	}

	/**
	 * 查询小节信息
	 * @param chParentid 课程编号
	 * @return
	 */
	@Override
	public List<Chapters> selectChaptersByParentId(String chParentid) {
		return chaptersMapper.selectChaptersByParentId(chParentid);
	}

	/**
     * 新增大纲
     * 
     * @param chapters 大纲信息
     * @return 结果
     */
	@Override
	public int insertChapters(Chapters chapters)
	{
	    return chaptersMapper.insertChapters(chapters);
	}
	
	/**
     * 修改大纲
     * 
     * @param chapters 大纲信息
     * @return 结果
     */
	@Override
	public int updateChapters(Chapters chapters)
	{
	    return chaptersMapper.updateChapters(chapters);
	}

	/**
     * 删除大纲对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteChaptersByIds(String ids)
	{
		return chaptersMapper.deleteChaptersByIds(Convert.toStrArray(ids));
	}
	
}
